var $ = require("../../utils/Ajax.js");
Page({
  data: {
    UserInfor: null
  },

  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: "我的钱包"
    }) 
  },

  onShow: function () {
    var that = this;
    $.Ajax("api/uindex", "GET", {}, function (res) {
      if (res.s) {
        wx.setStorageSync('UserInfor', res.d.user);
        that.setData({
          UserInfor: res.d.user
        })
      }
    })
  },

  // 点击更多
  More: function(){
    wx.showActionSheet({
      itemList: ['支付安全', '交易记录'],
      success: function (res) {
        if (!res.cancel) {
          var Index = res.tapIndex;
          if (Index == 0){
            wx.navigateTo({
              url: '../PaySecurity/PaySecurity',
            })
          } else if (Index == 1){
            wx.navigateTo({
              url: '../TransactionRecord/TransactionRecord',
            })
          }
        }
      }
    });
  },

  // 点击充值财富豆
  TopUpBeans: function(){
    wx.navigateTo({
      url: '../TopUpBeans/TopUpBeans',
    })
  },

  // 点击提现按钮
  Cash: function(){
    wx.navigateTo({
      url: '../Cash/Cash',
    })
  },

  // 点击进入提现记录
  Record: function(){
    wx.navigateTo({
      url: '../Record/Record',
    })
  },

  // 点击进入我的背包
  Knapsack: function(){
    wx.navigateTo({
      url: '../Knapsack/Knapsack',
    })
  },

  // 点击进入优惠券
  Coupon: function(){
    wx.navigateTo({
      url: '../Coupon/Coupon',
    })
  }
})